cmake_minimum_required(VERSION 2.6)

set(ENV{PROJECT_NAME} SDL_Project)

#set the project
project($ENV{PROJECT_NAME})

#set environment variables to be used later
set(ENV{EXECUTABLE_NAME} trips.out)





#include directories
INCLUDE(FindSDL)
INCLUDE(FindSDL_image)

#find packages
FIND_PACKAGE(SDL REQUIRED)
FIND_PACKAGE(SDL_image REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(GLUT REQUIRED)

include_directories(${SDL_INCLUDE_DIR})


#check if they've been found
IF(SDLIMAGE_FOUND)
	MESSAGE("SDL IMAGE FOUND")
	INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})
ELSE(SDLIMAGE_FOUND)
	MESSAGE( "SDL IMAGE NOT FOUND" )
ENDIF(SDLIMAGE_FOUND)



IF(SDL_FOUND)
        MESSAGE("SDL Found")
        INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
ELSE(SDL_FOUND)
        MESSAGE("SDL not found")
ENDIF(SDL_FOUND)


if ( NOT SDL_FOUND )
   message ( FATAL_ERROR "SDL not found!" )
endif ( NOT SDL_FOUND )


#link all our libraries
link_libraries( ${SDL_LIBRARY}
  ${SDLIMAGE_LIBRARY}
  ${OPENGL_LIBRARIES}
SDLmain

#SET(CMAKE_EXE_COMPILER_FLAGS -g)

)

#create the executable, using the environment
#variables previously declared
ADD_EXECUTABLE(AHill.out
		 draw.h loadtexture.h main.cpp resize_and_init.h global.h ReadFile.h printShaderInfoLog.h printProgramInfoLog.h textFileWrite.h LoadRawFile.h Hill_Block_Group.h Hill_Block_Group.cpp  Hill_Mesh.h Hill_Mesh.cpp Hill_Cube.h Hill_Cube.cpp Hill_Pyramid.h Hill_Pyramid.cpp)
